#ifndef _OOGLTEXTURE_H_
#define _OOGLTEXTURE_H_

#include "ooengine.h"
#include "resource/ooiresource.h"
#include "gl/glew.h"

//------------------------------------------------------------------------
class ooGLTexture : public ooIResource
{
	friend class ooFreeImageImageCodec;
public:
	static const String ms_xmlTexture;
	static const String ms_xmlPath;
	static const String ms_xmlImage;
	static const String ms_xmlName;
	static const String ms_xmlX;
	static const String ms_xmlY;
	static const String ms_xmlWidth;
	static const String ms_xmlHeight;
public:
	void					defineImage(const String& name, dbbindex x, dbbindex y, dbbsize width, dbbsize height);

	dbbsize					getWidth() const;
	dbbsize					getHeight() const;

	GLuint					getTextureId();

	//override
	virtual const String&	getResourceType() const;
	virtual TiXmlElement*	serializeXml();
	virtual bool			deserializeXml(TiXmlElement* ele);
protected:
	//memory texture
	ooGLTexture(const String& url);
	~ooGLTexture();

protected:
	bool					m_memoryTexture;
	String					m_filename;
	GLuint					m_texture;
	dbbsize					m_width;
	dbbsize					m_height;
};

#endif